otel: fix service.name for beats receivers#44831
Merged
mauri870 merged 3 commits intoelastic:mainfrom Jun 17, 2025
Merged
Conversation
Beats receivers currently use the hostname as the "service.name" logger field. Adjust it to reflect the beat name for consistency with standard beats.
Contributor
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the service.name logger field for Beats receivers to use the beat name instead of the hostname.
- Added a new
Beatfield to theReceiverConfigstruct and tests - Updated
logpConfig.Beatto referenceInfo.Beatinstead ofInfo.Name - Extended OTEL test helpers to validate and assert the new
service.namefield
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| x-pack/metricbeat/mbreceiver/receiver_test.go | Added Beat: "metricbeat" to test receiver configurations |
| x-pack/filebeat/fbreceiver/receiver_test.go | Added Beat: "filebeat" to test receiver configurations |
| x-pack/libbeat/cmd/instance/beat.go | Changed logpConfig.Beat assignment to use b.Info.Beat |
| libbeat/otelbeat/oteltest/oteltest.go | Introduced Beat field, validation, helper, and assertions |
Comments suppressed due to low confidence (3)
libbeat/otelbeat/oteltest/oteltest.go:44
- [nitpick] Consider adding a comment for the
Configfield to match the style of other struct field comments.
Config component.Config
libbeat/otelbeat/oteltest/oteltest.go:138
- [nitpick] The function name
beatForCompIDis terse; consider renaming togetBeatForComponentIDorresolveBeatByComponentIDfor clarity.
beatForCompID := func(compID string) string {
x-pack/libbeat/cmd/instance/beat.go:113
- Ensure project and user-facing documentation is updated to reflect that
logpConfig.Beatnow usesInfo.Beatinstead ofInfo.Name.
logpConfig.Beat = b.Info.Beat
Contributor
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
leehinman
approved these changes
Jun 16, 2025
swiatekm
approved these changes
Jun 17, 2025
mergify bot
pushed a commit
that referenced
this pull request
Jun 17, 2025
* otel: fix service.name for beats receivers Beats receivers currently use the hostname as the "service.name" logger field. Adjust it to reflect the beat name for consistency with standard beats. * use require.Contains before Equal * fix linter issues (cherry picked from commit df3dcad) # Conflicts: # x-pack/filebeat/fbreceiver/receiver_test.go
mergify bot
pushed a commit
that referenced
this pull request
Jun 17, 2025
* otel: fix service.name for beats receivers Beats receivers currently use the hostname as the "service.name" logger field. Adjust it to reflect the beat name for consistency with standard beats. * use require.Contains before Equal * fix linter issues (cherry picked from commit df3dcad) # Conflicts: # x-pack/filebeat/fbreceiver/receiver_test.go
This was referenced Jun 17, 2025
mauri870
added a commit
that referenced
this pull request
Jun 17, 2025
…44863) * otel: fix service.name for beats receivers (#44831) * otel: fix service.name for beats receivers Beats receivers currently use the hostname as the "service.name" logger field. Adjust it to reflect the beat name for consistency with standard beats. * use require.Contains before Equal * fix linter issues (cherry picked from commit df3dcad) # Conflicts: # x-pack/filebeat/fbreceiver/receiver_test.go * fix conflicts --------- Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870
added a commit
that referenced
this pull request
Jun 17, 2025
…4864) * otel: fix service.name for beats receivers (#44831) * otel: fix service.name for beats receivers Beats receivers currently use the hostname as the "service.name" logger field. Adjust it to reflect the beat name for consistency with standard beats. * use require.Contains before Equal * fix linter issues (cherry picked from commit df3dcad) # Conflicts: # x-pack/filebeat/fbreceiver/receiver_test.go * fix conflicts --------- Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed commit message
Beats receivers currently use the hostname as the "service.name" logger field. Adjust it to reflect the beat name for consistency with standard beats.
Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Related issues